package com.whu.waterworks.action;

import com.opensymphony.xwork2.ActionSupport;
import com.whu.waterworks.model.Alert;
import com.whu.waterworks.service.AlertService;

public class UpdateAlert extends ActionSupport{

	private static final long serialVersionUID = -1884201585951949395L;
	private AlertService alertService;
	private Alert alert=new Alert();
	String result="";
	
	@Override
	public String execute() throws Exception {
		System.out.println("alert:"+alert.getAlertType());
		if (alertService.updateAlert(alert)==true) {
			result="success";
			System.out.println("result"+result);
			return SUCCESS;
		}
		else {
			result="error";
			return ERROR;
		}
	}
	
	public String add() {
		System.out.println("alert:"+alert.getAlertType());
		if (alertService.saveAlert(alert)==true) {
			result="success";
			System.out.println("result"+result);
			return SUCCESS;
		}
		else {
			result="error";
			return ERROR;
		}
	}

	public AlertService getAlertService() {
		return alertService;
	}

	public void setAlertService(AlertService alertService) {
		this.alertService = alertService;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public Alert getAlert() {
		return alert;
	}

	public void setAlert(Alert alert) {
		this.alert = alert;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	} 
} 
